#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define int long long
using namespace std;
const int _=1e6+7;
void solve() {
int n;
cin>>n;
vector<int> a(n+1),s(n+1);
FOR(i,1,n) {
cin>>a[i];
s[i]=s[i-1]^a[i];
}
vector dp(n+1,vector<bool>(n+1,0));
vector L(n+1,0ll),R=L;
int js=0;
for(int len=n;len>=1;--len) {
for(int l=1,r=len;r<=n;++l,++r) {
int x=s[r]^s[l-1];
x|=(1ll<<60);
dp[l][r]=(L[l]&x) | (R[r]&x);
if(len==n) dp[l][r]=1;
if(dp[l][r]==0) continue;
int val= (s[r]^s[l-1]) > 0 ? (1ll<<__lg((s[r]^s[l-1]))) : ((1ll<<60));
L[l]|=val;
R[r]|=val;
}
}
FOR(i,1,n) cout<<dp[i][i];
cout<<"\n";
}
signed main() {
#ifdef ONLINE_JUDGE
ios::sync_with_stdio(false);cin.tie(0);
#else
freopen("a.in","r",stdin);
#endif
int T;
cin>>T;
while(T--) {
solve();
}
return 0;
}
553A - Kyoya and Colored Balls | 1364A - XXXXX |
1499B - Binary Removals | 1569C - Jury Meeting |
108A - Palindromic Times | 46A - Ball Game |
114A - Cifera | 776A - A Serial Killer |
25B - Phone numbers | 1633C - Kill the Monster |
1611A - Make Even | 1030B - Vasya and Cornfield |
1631A - Min Max Swap | 1296B - Food Buying |
133A - HQ9+ | 1650D - Twist the Permutation |
1209A - Paint the Numbers | 1234A - Equalize Prices Again |
1613A - Long Comparison | 1624B - Make AP |
660B - Seating On Bus | 405A - Gravity Flip |
499B - Lecture | 709A - Juicer |
1358C - Celex Update | 1466B - Last minute enhancements |
450B - Jzzhu and Sequences | 1582C - Grandma Capa Knits a Scarf |
492A - Vanya and Cubes | 217A - Ice Skating |